/*
 * @Author: xujianwei
 * @Date: 2021-04-29 11:31:39
 * @LastEditors: xujianwei
 * @LastEditTime: 2021-04-29 16:27:59
 */
import { defineComponent,onMounted, reactive } from 'vue'
import  {dailyVerse} from '@/api/util'
import './style.scss'
 export default defineComponent({
    setup(){
         let verse = reactive({
             type:'',
             title:'',
             author:'',
             paragraphs:[]
         })
        onMounted(async ()=>{
            let {data = {}} = await dailyVerse()
            let res = data.res || {}
            res = res[0]
            verse.type = data.type
            verse.title = res.title || res.rhythmic
            verse.author = res.author
            verse.paragraphs = res.paragraphs
        })
         return () =>{
             return <div class='dailyVerse'>
             <div class='title'>{verse.title}</div>
             <div class='author'>{verse.author}</div>
             {
                  verse.paragraphs.map(item=>{
                      return <p>{item}</p>
                  })
             }
             </div>
         }
     }
 })